package dao.impl;

import dao.IOrderGoodsDao;
import model.OrderGoods;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @aythor:侯仪澳
 * @data:2022/7/29
 */
@Repository

public class OrderGoodsDao implements IOrderGoodsDao {

    @Autowired
    private SqlSession sqlSession;
    String url = "dao.IOrderGoodsDao.";

    @Override
    public List<OrderGoods> queryOrderGoods(OrderGoods orderGoods) {
        return sqlSession.selectList(url + "queryOrderGoods",orderGoods);
    }

    @Override
    public int addOneOrderGoods(OrderGoods orderGoods) {
        return sqlSession.insert(url + "addOneOrderGoods",orderGoods);
    }

    //查询订单里的商品
    @Override
    public List<OrderGoods> queryGoodsToOrder(OrderGoods orderGoods) {
        return sqlSession.selectList(url + "queryGoodsToOrder",orderGoods);
    }
}
